/*
 *  fsutils.h
 *
 * (C) 2007 by Greg Hedlund
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#import <pthread.h>
#include <unistd.h>
#include <sys/param.h>
#include <sys/ucred.h>
#include <sys/mount.h>

#import <DiskArbitration/DiskArbitration.h>

extern kern_return_t DiskArbInit(void)
__attribute__((weak_import));
extern kern_return_t DiskArbDiskAppearedWithMountpointPing_auto(
  char     *disk,
  unsigned  flags,
  char     *mountpoint
) __attribute__((weak_import)); 

enum {
        kDiskArbDiskAppearedEjectableMask   = 1 << 1,
        kDiskArbDiskAppearedWholeDiskMask   = 1 << 2,
        kDiskArbDiskAppearedNetworkDiskMask = 1 << 3
}; 

/* Set the kHasCustomIcon flag on the specified folder */
OSStatus set_custom_icon_flag(char *path);

/* Is the specified directory in fstab */
bool is_directory_in_fstab(char *path);

/* Begins a thread which waits for the specified path to be in fstab, 
 * copies the given icon to path/.VolumeIcon.icns and pings disk
 * arbitration.
 */
void set_icon_and_ping_diskarb(pthread_t *thread, char *path);
